from urllib.parse import quote_plus as urlquote
from datetime import timezone

class BaseConfig:
    # mysql 配置
    MYSQL_USERNAME = "root"
    MYSQL_PASSWORD = "troila@root"
    MYSQL_HOST = "172.27.105.192"
    MYSQL_PORT = 3306
    MYSQL_DATABASE = "alchemy"

    SESSION_PERMANENT = True
    SESSION_TYPE = "filesystem"
    SECRET_KEY = "troila"

    TIMEZONE = timezone.utc

    # 自动会追踪对象的修改并且发送信号
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    # 输出sql语句
    SQLALCHEMY_ECHO = True

    # 数据库的配置信息
    SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://{MYSQL_USERNAME}:{urlquote(MYSQL_PASSWORD)}@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DATABASE}?charset=utf8mb4"

